<template>
	<view>
		<view class="header">消耗记录</view>
		<view class="table">
			<table border="0" width="95%" cellspacing="0" cellpadding="0"
			v-for="(item,index) in list" :key="index">
				<tr>
					<td>项目名称</td>
					<td colspan="2">{{item.card_name}}</td>
				</tr>
				<tr>
					<td>顾客姓名</td>
					<td>美容师</td>
					<td>服务日期</td>
				</tr>
				<tr>
					<td>{{item.member_name}}</td>
					<td>{{item.user_name}}</td>
					<td>{{item.date}}</td>
				</tr>
			</table>
		</view>
	</view>
</template>
<script>
import request from '@/util/request.js'
export default {
	data() {
		return {
			list:[],
			page:1,
			pageShow:true,
			oaRole:0
		}
	},
	onLoad:function(){
		this.oaRole = uni.getStorageSync('oaRole')
		uni.showLoading({
		    title: '加载中'  
		});
		this.getList();
	},
	methods: {
		getList:function(){
			var data = {
				page:this.page,
			}
			if(uni.getStorageSync('oaRole') == 2){
				data.uid = uni.getStorageSync('uid')
			}else{
				data.oa_id = uni.getStorageSync('oa_id')
			}
			var that = this
			request({
				url: 'manage/my/conn',
				method: 'get',
				data:data,
				success: (res) => {
					uni.hideLoading();
					if(res.data.code == 1){
						if(res.data.data.last_page <= that.page){
							that.pageShow = false
						}
						if(that.page == 1){
							that.list = res.data.data.data
						}else{
					        var list = that.list
					        that.list = list.concat(res.data.data.data)
					    }
					}
				},
			})
		},
		select:function(key){
			this.type = key
			this.page = 1
			this.pageShow = true
			this.list = []
			uni.showLoading({
			    title: '加载中'  
			});
			this.getList();
		},
		onReachBottom: function(){
			if(this.pageShow){
				 //当前不是最后一页可加载
				 this.page = this.page + 1
				 uni.showLoading()
				 this.getList();
			}
		},
		jump:function(url,json,pay){
			uni.navigateTo({
			  url:url+'?json='+JSON.stringify(json)+'&pay='+pay
			})
		}
	},
}
</script>
<style>
.td_img{
	width:40rpx;
	height:40rpx;
}
.header{
    width:100%;
    height:80rpx;
    line-height: 80rpx;
    text-align: center;
    background:#00b300;
    color:#fff;
}
.table{
	width:100%;
	padding:10rpx 20rpx 120rpx 20rpx;
}
table{
	margin-top:30rpx;
}
td{
	border:1rpx solid #C8C7CC;
	text-align: center;
	height:70rpx;
	line-height:70rpx;
}
.select{
	width:100%;
	height:80rpx;
	line-height: 80rpx;
	display: flex;
	flex-direction: row;
	border-bottom:1px solid #000000;
	text-align: center;
}
.select_line{
	width:50%;
}
.border-right{
	border-right:1rpx solid #000000;
}
.border-bottom{
	border-bottom:5rpx solid red;
}
</style>